<?php
    class WZ_Simpledb
    {
        static $_instance;
        private static $_domain;
        private static $_db;
        
        public static function getInstance($domain)
        {
            if (null === self::$_instance) {
                self::$_instance = new self($domain);
            }
            return self::$_instance;
        }
        
        public function __construct($domain)
        {
            $config = \WZ::get('confApp')->confApp;
            self::$_domain = $domain;
            self::$_db = new \Zend_Service_Amazon_SimpleDb($config['aws']['id'], $config['aws']['key']);
            if (!self::$_db->createDomain(self::$_domain)) {
                die('Problem create sdb domain');
            }
        }
        
        public static function getDb()
        {
            return self::$_db;
        }
    }